package cn.hotel.servlet;


import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import static cn.hotel.utlis.CheckCodeUtil.outputVerifyImage;
@WebServlet( "/checkServlet")
public class CheckServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ServletOutputStream os = response.getOutputStream();
        String checkCode = outputVerifyImage(100, 40, os, 4);

        //存放到Session
        HttpSession session = request.getSession();
        session.setAttribute("checkCodeGen",checkCode);
    }
}
